<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <script>
       // 给定一个整数数组和一个目标值，找出数组中和为目标值的两个数。
//示例：

//给定 nums = [2, 7, 11, 15], target = 9

//因为 nums[0] + nums[1] = 2 + 7 = 9
//所以返回 [0, 1,1,0]

        let arr = [1,4,8,6,5,3,6,7,0,9],target=9,newArr=[];
        for(let i = 0;i<arr.length;i++) {
            for(let j = 0;j<arr.length;j++) {
                if(arr[i]+arr[j]==target) {
                        newArr.push(i,j)
                        continue
                }
            }
            
        }

        console.log(newArr)
    </script>
</body>

</html>